package cn.ifavor.googleplay.holder;

import java.util.ArrayList;
import java.util.List;

import android.view.View;
import cn.ifavor.googleplay.R;
import cn.ifavor.googleplay.base.BaseViewHolder;
import cn.ifavor.googleplay.constants.URLConstant;
import cn.ifavor.googleplay.domain.DetailInfo;

public class DetailScreenHolder extends BaseViewHolder<DetailInfo> {
	private List<View> mViewList = new ArrayList<View>();

	public DetailScreenHolder(int layoutId) {
		super(layoutId);

		initMyView();
	}

	private void initMyView() {
		mViewList.add(getView(R.id.screen_1));
		mViewList.add(getView(R.id.screen_2));
		mViewList.add(getView(R.id.screen_3));
		mViewList.add(getView(R.id.screen_4));
		mViewList.add(getView(R.id.screen_5));
		
	}

	@Override
	public void setData(DetailInfo data) {
		
		if (data.getScreen() != null && data.getScreen().size() > 0){
			for (int i = 0; i < data.getScreen().size(); i++) {
				String imageURL = URLConstant.baseURL + "/image?name="+ data.getScreen().get(i);
				bitmapUtils.display(mViewList.get(i), imageURL);
				mViewList.get(i).setVisibility(View.VISIBLE);
			}
			
			for (int i = data.getScreen().size(); i < 5; i++) {
				mViewList.get(i).setVisibility(View.GONE);
			}
		}
	}

}
